<?php
//use \PFT\Db;
//include_once '/var/www/html/new/d/module/common/Db.class.php';
//include_once '/var/www/html/new/d/common/func.inc.php';
//$dbConf = include_once '/var/www/html/new/d/module/common/db.conf.php';// 远端服务器配置信息
//Db::Conf($dbConf['localhost']);
//$sql_edit="select id from uu_products where apply_did={$_SESSION['sid']} and apply_limit=1";
//$stmt = Db::Connect()->prepare($sql_edit);
//$stmt->execute();
//while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
//    $pid_lit.=$row['id'].',';
//}
//$pid_lit=trim($pid_lit,',');
//
//$sql="select id,uuid from uu_jq_ticket where pid in($pid_lit) and LENGTH(uuid)=32";
//$stmt = Db::Connect()->prepare($sql);
//$stmt->execute();
//$RES=$stmt->fetchAll(PDO::FETCH_ASSOC);
//echo '<pre>';
//print_r($RES);
//echo '</pre>';
//
//
//exit;
$custId = '124625'; //二维码商帐号
$p_encode='a44e45409a99d71088bea2c12314a85c';
$time=time();
if($_GET['action']=='send'){
    $array = array(
        'custId'	=> '124625',
        'encode'	=>  md5($p_encode.$time.$custId),
        'time'		=> $time,
        'productId'	=> "46888|10675|22219",
        'mobile'    => '13675094589',
        'orderId'	=> 'nuomi20151016008',
        'count'	     => 3
    );
    $url = 'http://www.12301.cc/module/wxh/nm/test.php';
}elseif($_GET['action']=='cancel'){
    $array = array(
        'custId'	=> '124625',
        'encode'	=>  md5($p_encode.$time.$custId),
        'time'		=> $time,
        'orderId'   => $_GET['id'],
        'thirdOrderId'	=> 'nuomi20151016002',
        'count'	=> 2
    );
    $url = 'http://www.12301.cc/module/wxh/nm/cancel.php';
}elseif($_GET['action']=='resend'){
    $array = array(
        'custId'	=> '124625',
        'encode'	=>  md5($p_encode.$time.$custId),
        'time'		=> $time,
        'orderId'   => $_GET['id'],
        'thirdOrderId'	=> 'nuomi20151016002',
        'mobile'	=> '13675094589',
        'productId'	=> "46888|10675|22219",
    );
    $url = 'http://www.12301.cc/module/wxh/nm/resend.php';
}

$request = post($array,$url);
echo '<pre>';
print_r($request);
echo '</pre>';
function post($request_arr,$url){
    $post_data = http_build_query($request_arr);
    // print_r($post_data);exit;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    $reponse = curl_exec($ch);
    curl_close($ch);
    return $reponse;
}
